package com.sky.service.impl;
import com.sky.constant.StatusConstant;
import com.sky.context.BaseContext;
import com.sky.entity.UserStatus;
import com.sky.mapper.UserStatusServiceMapper;
import com.sky.service.UserStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;

/**
 * @author 符健清
 * @version 1.0
 */
@SuppressWarnings({"all"})
@Slf4j
@Service
public class UserStatusServiceimp  implements UserStatusService {
    @Autowired
    private UserStatusServiceMapper userStatusServiceMapper;

    @Override
    public void insertUserStatus(UserStatus userStatus) {
//        修改参数
        userStatus.setUserId(BaseContext.getCurrentId());
        userStatusServiceMapper.insertUserStatus(userStatus);
    }

    @Override
    public void updateUserStatus(UserStatus userStatus) {
        userStatus.setStatus(StatusConstant.DISABLE);
        userStatus.setUserId(BaseContext.getCurrentId());
        userStatus.setUpdateDatetime(LocalDateTime.now());
        log.info("userStatus:{}",userStatus);
        userStatusServiceMapper.updateUserStatus(userStatus);

    }
}
